# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=zeitgeist
pkgver=1.0.4
pkgrel=3
pkgdesc="Activity logging framework"
arch="all"
url="https://zeitgeist.freedesktop.org/"
license="LGPL-2.1-or-later"
depends_dev="
	sqlite-dev
	gobject-introspection-dev
	xapian-core-dev
	telepathy-glib-dev
	gtk+3.0-dev
	json-glib-dev
	"
makedepends="
	$depends_dev
	autoconf
	automake
	gettext-dev
	libtool
	py3-rdflib
	vala
	git
	raptor2
	"
checkdepends="dbus-test-runner"
source="https://gitlab.freedesktop.org/zeitgeist/zeitgeist/-/archive/v$pkgver/zeitgeist-v$pkgver.tar.gz"
subpackages="
	$pkgname-dev
	$pkgname-doc
	lib$pkgname:libs
	py3-$pkgname:py3:noarch
	$pkgname-bash-completion
	"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check" # tests fail to build

prepare() {
	default_prepare

	NOCONFIGURE=1 ./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib \
		--enable-fts

	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

	make
}

check() {
	dbus-test-runner -t make -p check
}

package() {
	make DESTDIR="$pkgdir" install

	# systemd
	rm -rf "$pkgdir"/usr/lib/systemd
}

py3() {
	pkgdesc="Python3 bindings for $pkgname"
	depends="python3 lib$pkgname=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib
}

sha512sums="
54dfbed79d1536a39888f9215dee3e769e3e12581d87b6e0ab30f2675fe9680b87b8fb2e616bdb6609572a289dde1f377e60e5f8dae58ccdda2776c7c7f58888  zeitgeist-v1.0.4.tar.gz
"
